# -*- coding: utf-8 -*-

import requests
from lxml import html

payload = {
    "user": "18915777427",
    "pwd": "llr139248"
}

#创建session对象
session_requests = requests.session()

login_url = "https://account.xiaomi.com/pass/serviceLogin"

result = session_requests.post(
    login_url,
    data = payload,
    headers = dict(referfer = login_url)
)

# print result.ok # 会告诉我们最后一次请求是否成功
# print result.status_code # 会返回给我们最后一次请求的状态

#tree = html.fromstring(result.text)

tree = html.fromstring(result.content)
bucket_elems = tree.findall('.//h4[@class="title-big dis-inb"]/text()')
bucket_names = [bucket.text_content.replace("n", "").strip() for bucket in bucket_elems]

print bucket_names
